/*
 * PartComboBoxModel.java
 *
 * Created on December 22, 2006, 10:19 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.sun.demo.addressbook;

import javax.swing.DefaultComboBoxModel;

/**
 *
 * @author rhisld
 */
public class PartComboBoxModel extends DefaultComboBoxModel {
    
    /** Creates a new instance of PartComboBoxModel */
    public PartComboBoxModel() {
        super();
    }

    public PartListEntry getObjectByPartId(int partId) {
        PartListEntry entryForId = null;
        for (int i = 0; i < getSize(); i++) {
            PartListEntry entry = (PartListEntry)getElementAt(i);
            if (entry.getId() == partId) {
                entryForId = entry;
            }
        }
        return entryForId;
    }

//    public void addElement(Object comboBoxEntry) {
//        super.addElement(comboBoxEntry);
//    }
}
